<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2020/12/23
  Time: 20:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
    <head>
        <title>展示所有商品</title>
    </head>
    <body>
        <div>
            <table style="border: 1px" align="center">
                <thead>
                <tr>
                    <td><a href="${pageContext.request.contextPath}/add.jsp"><button>添加</button></a></td>
                </tr>
                <tr>
                    <th>编号</th>
                    <th>名称</th>
                    <th>作者</th>
                    <th>价格</th>
                    <th>库存</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                    <c:forEach var="b" items="${books}">
                        <tr>
                            <td>${b.bookId}</td>
                            <td>${b.bookName}</td>
                            <td>${b.author}</td>
                            <td>${b.price}</td>
                            <td>${b.stock}</td>
                            <td>
                                <a href="${pageContext.request.contextPath}/book/delete.do?bookId=${b.bookId}"><button>删除</button></a>
                                <a href="${pageContext.request.contextPath}/book/showOne.do?bookId=${b.bookId}"><button>更新</button></a>
                            </td>
                        </tr>
                    </c:forEach>
                </tbody>
            </table>
            <p align="center">
                <c:forEach items="${pages}" var="p">
                    <tr>
                        <a href="${pageContext.request.contextPath}/book/show.do?pageNum=${p}"><button>${p}</button></a>
                    </tr>
                </c:forEach>
            </p>
        </div>
        </form>
    </body>
</html>
